home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / minix / up1510b.tgz / up1510b / src / kernel / stmpx.s.D < prev    next >
Text File  |  1990-07-25  |  6KB  |  277 lines

  1. *** /tmp/,RCSt1022335    Wed Jul 25 13:56:07 1990
  2. --- stmpx.s    Sun Jul 15 08:29:11 1990
  3. ***************
  4. *** 1,2 ****
  5. ! #ifdef ATARI_ST
  6.   
  7. --- 1,4 ----
  8. ! #include <minix/config.h>
  9. ! #include "const.h"
  10. ! #if (CHIP == M68000)
  11.   
  12. ***************
  13. *** 26,27 ****
  14. --- 28,30 ----
  15.       .define    _lock
  16. +     .define    _unlock
  17.       .define    _restore
  18. ***************
  19. *** 37,43 ****
  20.   !
  21.       .extern    _proc_ptr
  22. -     .extern    _cur_proc
  23.       .extern    _rdy_head
  24. !     .extern    _pick_proc
  25. !     .extern    _t_stack
  26.       .extern    _main
  27. --- 40,47 ----
  28.   !
  29. +     .extern    _clock_handler
  30. +     .extern    _held_head
  31. +     .extern _k_reenter
  32.       .extern    _proc_ptr
  33.       .extern    _rdy_head
  34. !     .extern    _lock_pick_proc
  35.       .extern    _main
  36. ***************
  37. *** 47,49 ****
  38.       .extern    _timint
  39. -     .extern    _clockint
  40.       .extern    _dmaint
  41. --- 51,52 ----
  42. ***************
  43. *** 58,66 ****
  44.   !
  45. - ! manifest constants to be included from kernel/const.h
  46. - !
  47. - TASK_STACK_BYTES= 1024
  48. - IDLE        = -999
  49. - TASK_Q        = 0
  50. - !
  51.   ! offsets into a proc table entry
  52. --- 61,62 ----
  53. ***************
  54. *** 69,73 ****
  55.   savsp    = 60
  56. ! savsr    = 64
  57. ! savpc    = 66
  58. ! savtt    = 75
  59.   
  60. --- 65,69 ----
  61.   savsp    = 60
  62. ! savpc    = 64
  63. ! savsr    = 68
  64. ! savtt    = 77
  65.   
  66. ***************
  67. *** 79,81 ****
  68.   .data2    0x0400,    trp,    0x0500,    trp,    0x0600,    trp,    0x0700,    trp
  69. ! .data2    0x0800,    trp,    0x0900,    trp,    0x0A00,    trp,    0x0B00,    trp
  70.   .data2    0x0C00,    trp,    0x0D00,    trp,    0x0E00,    trp,    0x0F00,    trp
  71. --- 75,77 ----
  72.   .data2    0x0400,    trp,    0x0500,    trp,    0x0600,    trp,    0x0700,    trp
  73. ! .data2    0x0800,    trp,    0x0900,    trc,    0x0A00,    trp,    0x0B00,    trp
  74.   .data2    0x0C00,    trp,    0x0D00,    trp,    0x0E00,    trp,    0x0F00,    trp
  75. ***************
  76. *** 153,155 ****
  77.       move.w    #0x2700,sr
  78. !     move.l    #_t_stack+TASK_STACK_BYTES,sp
  79.   !    move.l    #_end,d0
  80. --- 149,151 ----
  81.       move.w    #0x2700,sr
  82. !     move.l  #k_stktop,sp    
  83.   !    move.l    #_end,d0
  84. ***************
  85. *** 171,173 ****
  86.   trp:
  87. !     jsr    save
  88.       jsr    _trap
  89. --- 167,169 ----
  90.   trp:
  91. !     bsr    save
  92.       jsr    _trap
  93. ***************
  94. *** 174,177 ****
  95.       bra    restart
  96.   int:
  97. !     jsr    save
  98.       jsr    _rupt
  99. --- 170,177 ----
  100.       bra    restart
  101. + trc:
  102. +     btst    #5,(sp)        ! tracing through trap?
  103. +     beq    trp        ! No, do normal trace processing
  104. +     rte            ! don't trace; execute system call
  105.   int:
  106. !     bsr    save
  107.       jsr    _rupt
  108. ***************
  109. *** 179,181 ****
  110.   non:
  111. !     jsr    save
  112.       jsr    _none
  113. --- 179,181 ----
  114.   non:
  115. !     bsr    save
  116.       jsr    _none
  117. ***************
  118. *** 183,185 ****
  119.   sys:
  120. !     jsr    save            ! d0, d1 and a0 not modified
  121.       move.l    a0,-(sp)        ! m_ptr
  122. --- 183,185 ----
  123.   sys:
  124. !     bsr    save            ! d0, d1 and a0 not modified
  125.       move.l    a0,-(sp)        ! m_ptr
  126. ***************
  127. *** 186,191 ****
  128.       move.w    d1,-(sp)        ! src_dest
  129. -     move.w    _cur_proc,-(sp)        ! caller
  130.       move.w    d0,-(sp)        ! SEND/RECEIVE/BOTH
  131. !     jsr    _sys_call        ! sys_call(func,caller,src_dest,m_ptr)
  132. !     add.l    #10,sp
  133.       bra    restart
  134. --- 186,193 ----
  135.       move.w    d1,-(sp)        ! src_dest
  136.       move.w    d0,-(sp)        ! SEND/RECEIVE/BOTH
  137. !     move.l    _proc_ptr,a6        ! needed to store return value
  138. !                 ! warning: _sys_call may change _proc_ptr
  139. !     jsr    _sys_call        ! sys_call(func,src_dest,m_ptr)
  140. !     move.l  d0,(a6)
  141. !     add.l    #8,sp
  142.       bra    restart
  143. ***************
  144. *** 203,206 ****
  145.   clk:
  146.       movem.l    FREEREGS,-(sp)
  147. !     move.l    #_clockint,a0
  148.       bsr    async
  149. --- 205,213 ----
  150.   clk:
  151. +     sub.w    #1,clkcnt
  152. +     beq    cont
  153. +     rte
  154. + cont:
  155. +     move.w    #4,clkcnt
  156.       movem.l    FREEREGS,-(sp)
  157. !     move.l    #_clock_handler,a0
  158.       bsr    async
  159. ***************
  160. *** 244,245 ****
  161. --- 251,253 ----
  162.       move.w    d0,(sp)            ! push traptype as argument
  163. +     add.b    #1,_k_reenter        ! from -1 if not reentering
  164.       jsr    (a0)            ! call service routine
  165. ***************
  166. *** 247,259 ****
  167.       move.w    #0x2700,sr
  168.       movem.l    (sp)+,FREEREGS
  169. -     cmp.l    #0,_rdy_head+TASK_Q    ! any task just readied?
  170. -     beq    L3            ! no: branch and return from interrupt
  171.       btst    #5,(sp)            ! previously in kernel mode?
  172. !     beq    L4            ! no: branch and do task switch
  173. ! ! the next test is rather machine dependent
  174. ! ! for the Atari ST test for previous processor priority >= 4
  175. !     btst    #2,(sp)            ! interrupting interrupt?
  176.       bne    L3            ! yes: branch and return from interrupt
  177. !     cmp.w    #IDLE,_cur_proc        ! kernel mode but IDLE?
  178. !     beq    L4            ! yes: branch and do task switch
  179.   L3:
  180. --- 255,263 ----
  181.       move.w    #0x2700,sr
  182. +     sub.b    #1,_k_reenter
  183.       movem.l    (sp)+,FREEREGS
  184.       btst    #5,(sp)            ! previously in kernel mode?
  185. !                 ! (interrupted a task or another interrupt)
  186.       bne    L3            ! yes: branch and return from interrupt
  187. !     cmp.l    #0,_rdy_head+TASK_Q    ! any task just readied?
  188. !     bne    L4            ! yes: branch and do task switch
  189.   L3:
  190. ***************
  191. *** 261,264 ****
  192.   L4:
  193. !     jsr    save
  194. !     jsr    _pick_proc
  195.       bra    restart
  196. --- 265,268 ----
  197.   L4:
  198. !     bsr    save
  199. !     jsr    _lock_pick_proc
  200.       bra    restart
  201. ***************
  202. *** 283,285 ****
  203.       move.l    (sp)+,savpc(a6)        ! pc
  204. !     move.l    #_t_stack+TASK_STACK_BYTES,sp
  205.       jmp    (a1)
  206. --- 287,289 ----
  207.       move.l    (sp)+,savpc(a6)        ! pc
  208. !     add.b    #1,_k_reenter        ! from -1 if not reentering
  209.       jmp    (a1)
  210. ***************
  211. *** 287,292 ****
  212.   restart:
  213.       jsr    _checksp
  214. -     move.w    #0x2700,sr                    ! ?
  215. -     cmp.w    #IDLE,_cur_proc
  216. -     beq    idle
  217.       move.l    _proc_ptr,a6
  218. --- 291,306 ----
  219.   restart:
  220. + ! Flush any held-up interrupts.
  221. + ! This reenables interrupts, so the current interrupt handler may reenter.
  222. + ! This doesn't matter, because the current handler is about to exit and no
  223. + ! other handlers can reenter since flushing is only done when k_reenter == 0.
  224. +     move.w    #0x2700,sr
  225. +     tst.b    _k_reenter
  226. +     bne    over_call_unhold
  227. +     cmp.l    #0,_held_head
  228. +     beq    over_call_unhold
  229. +     jsr    _unhold
  230. + over_call_unhold:
  231. +     sub.b    #1,_k_reenter
  232.       jsr    _checksp
  233.       move.l    _proc_ptr,a6
  234. ***************
  235. *** 303,310 ****
  236.   
  237. - idle:
  238. -     .extern    _idle
  239. -     jsr    _idle
  240. - L8:    stop    #0x2200            ! wait enabled.
  241. -     bra    L8
  242.   _lock:
  243. --- 317,318 ----
  244. ***************
  245. *** 316,319 ****
  246.       rts
  247. - #ifdef NEEDED
  248. -     .define    _unlock
  249.   _unlock:
  250. --- 324,325 ----
  251. ***************
  252. *** 321,323 ****
  253.       rts
  254. - #endif
  255.   _reboot:
  256. --- 327,328 ----
  257. ***************
  258. *** 345,346 ****
  259. --- 350,356 ----
  260.   
  261. + clkcnt: .data2  4
  262. +     .space K_STACK_BYTES
  263. + k_stktop:
  264.   #ifdef ACK
  265. ***************
  266. *** 358,359 ****
  267.   
  268. ! #endif ATARI_ST
  269. --- 368,369 ----
  270.   
  271. ! #endif
  272.